package view.loadings
{
	import flash.display.Sprite;
	
	public class GrayLoadingMC extends Sprite implements ILoadingMC
	{
		private var loadingMC:GrayLoadingWaveRota;
		public function GrayLoadingMC()
		{
			loadingMC=new GrayLoadingWaveRota();
			this.addChild(loadingMC);
		}
		/**
		 * 设置进度的文本
		 */ 
		public function set text(text:String):void
		{
			if(text!=null)loadingMC.loadText.text=text;
		}
		/**
		 * 更新进度
		 */ 
		public function updateProgress(bytesLoaded:Number,bytesTotal:Number):void{
			loadingMC.percentageText.text=Math.round((bytesLoaded/bytesTotal)*100)+"%";
		}
		
		/**
		 * 销毁进度条
		 */ 
		public function dispose():void
		{
			if(loadingMC!=null)
			{
				if(loadingMC.parent!=null)
				{
					loadingMC.parent.removeChild(loadingMC);
				}
				loadingMC=null;
			}
		}
	}
}